<?php
/**
 * @file views-view-fields.tpl.php
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - $field->class: The safe class id to use.
 *   - $field->handler: The Views field handler object controlling this field. Do not use
 *     var_export to dump this object, as it can't handle the recursion.
 *   - $field->inline: Whether or not the field should be inline.
 *   - $field->inline_html: either div or span based on the above flag.
 *   - $field->separator: an optional separator that may appear before a field.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @ingroup views_templates
 */
?>
<?php $brand = strtolower($fields['name']->content) ?>
<?php $path = '/'.path_to_theme().'/images/products-' ?>
<div id="products-header">

<?php $xedapdien_show = false ?>
<?php $xemaydien_show = false ?>
<?php if (preg_match('@xedapdien$@', request_uri())): ?>
   <?php $xedapdien_show = true ?>
<?php elseif (preg_match('@xemaydien$@', request_uri())): ?>
   <?php $xemaydien_show = true ?>
<?php endif ?>
<?php if (!$xedapdien_show & !$xemaydien_show): ?>
  <div style="background: url(<?php echo $path, $brand, '.png' ?>) no-repeat top left; width: 168px; height: 39px; margin-left: 31px; position: absolute; cursor: pointer" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand ?>'"></div>
  <div class="more" style="cursor: pointer;" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand, '/xedapdien' ?>'">Xe đạp điện</div>
  </div>
  <?php if (!preg_match('@san-pham$@', request_uri())): ?>
    <?php print_r(views_embed_view('listproducts', 'page_1', $fields['name']->content, 'xedapdien')) ?>
  <?php else: ?>
    <?php print_r(views_embed_view('listproducts', 'default', $fields['name']->content, 'xedapdien')) ?>
  <?php endif ?>

  <div id="products-header">
  <?php /*
  <div style="background: url(<?php echo $path, $brand, '.png' ?>) no-repeat top left; width: 168px; height: 39px; margin-left: 31px; position: absolute; cursor: pointer" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand ?>'"></div> */ ?>
    <div class="more" style="cursor:pointer;" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand, '/xemaydien' ?>'">Xe máy điện</div>
  </div>
  <?php if (!preg_match('@san-pham$@', request_uri())): ?>
    <?php print_r(views_embed_view('listproducts', 'page_1', $fields['name']->content, 'xemaydien')) ?>
  <?php else: ?>
    <?php print_r(views_embed_view('listproducts', 'default', $fields['name']->content, 'xemaydien')) ?>
  <?php endif ?>
<?php elseif ($xedapdien_show): ?>
  <div style="background: url(<?php echo $path, $brand, '.png' ?>) no-repeat top left; width: 168px; height: 39px; margin-left: 31px; position: absolute; cursor: pointer" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand ?>'"></div>
  <div class="more" style="cursor: pointer;"  onclick="window.location='<?php echo base_path(), 'san-pham/', $brand, '/xedapdien' ?>'">Xe đạp điện</div>
  </div>
  <?php if (!preg_match('@san-pham$@', request_uri())): ?>
    <?php print_r(views_embed_view('listproducts', 'page_1', $fields['name']->content, 'xedapdien')) ?>
  <?php else: ?>
    <?php print_r(views_embed_view('listproducts', 'default', $fields['name']->content, 'xedapdien')) ?>
  <?php endif ?>

<?php elseif ($xemaydien_show): ?>
    <div style="background: url(<?php echo $path, $brand, '.png' ?>) no-repeat top left; width: 168px; height: 39px; margin-left: 31px; position: absolute; cursor: pointer" onclick="window.location='<?php echo base_path(), 'san-pham/', $brand ?>'"></div>
    <div class="more" style="cursor:pointer;"  onclick="window.location='<?php echo base_path(), 'san-pham/', $brand, '/xemaydien' ?>'">Xe máy điện</div>
  </div>
  <?php if (!preg_match('@san-pham$@', request_uri())): ?>
    <?php print_r(views_embed_view('listproducts', 'page_1', $fields['name']->content, 'xemaydien')) ?>
  <?php else: ?>
    <?php print_r(views_embed_view('listproducts', 'default', $fields['name']->content, 'xemaydien')) ?>
  <?php endif ?>
<?php endif ?>

<div id="products-footer"></div>
